Skip to content

Conversation

@Tpt
Copy link
Contributor

@Tpt Tpt commented Oct 23, 2025

No description provided.

@Tpt
Copy link
Contributor Author

Tpt commented Oct 23, 2025

An other approach might be to add a decorators field to the annotation data just like for functions. Might be worth it for extensibility if we want other class decorators in the future

Edit: moving to draft, this decorators idea makes more sense

@Tpt Tpt marked this pull request as ready for review October 23, 2025 08:48
@Tpt Tpt marked this pull request as draft October 23, 2025 08:56
@Tpt Tpt marked this pull request as ready for review November 13, 2025 17:13
@Tpt
Copy link
Contributor Author

Tpt commented Nov 13, 2025

I have rebased the MR to use the new decorators mechanism

if let TypeHintExpr::Identifier(i) = expr {
Ok(i)
} else {
bail!("A decorator must be the identifier of a Python function")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A decorator can also be a call to such function, I guess we can support in future? (Should the error message be clearer, if so?)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes! Improved message: 9bd50b5

Copy link
Member

@davidhewitt davidhewitt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, LGTM!

@davidhewitt davidhewitt added this pull request to the merge queue Nov 18, 2025
Merged via the queue into PyO3:main with commit b1a21cc Nov 18, 2025
41 of 42 checks passed
@Tpt Tpt deleted the tpt/final branch November 20, 2025 15:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants